﻿///

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Addin665.Contract;
using EnvDTE80;
using EnvDTE;

namespace Addin665.Commands {
    abstract class CommandBase : ICommand {
        private object _hook;
        bool _Enabled;
        string _Name;
        string _Tips;
        private DTE2 _applicationObject;
        private AddIn _addInInstance;

        protected object Hook {
            get { return _hook; }
            set { _hook = value; }
        }

        protected DTE2 ApplicationObject {
            get { return _applicationObject; }
            set { _applicationObject = value; }
        }

        protected AddIn AddInInstance {
            get { return _addInInstance; }
            set { _addInInstance = value; }
        }

        public virtual bool Enabled {
            get { return _Enabled; }
            set { _Enabled = value; }
        }

        public virtual string Name {
            get { return _Name; }
            protected set { _Name = value; }
        }

        public virtual string Tips {
            get { return _Tips; }
            set { _Tips = value; }
        }

        public virtual void OnCreate(object hook) {
            _hook = hook;
            object[] objs = _hook as object[];
            if (objs != null) {
                _applicationObject = objs[0] as DTE2;
                _addInInstance = objs[1] as AddIn;
            }
            //_addInInstance = app.AddInInstance; 
        }

        public virtual void OnClick() {

        }

    }
}
